package lp;

/**
 * 移动零
 *
 * @author lipeng
 * @date 2020/12/7 13:05
 */
public class LeetCode_283 {

    /**
     * 移动零
     *
     * @param nums 数组
     */
    public void moveZeroes(int[] nums) {
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                int temp = nums[index];
                nums[index] = nums[i];
                nums[i] = temp;
                index++;
            }
        }
    }
}
